<!doctype html>



  


<html class="theme-next muse use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  
    
      
    

    
  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Microsoft YaHei:300,300italic,400,400italic,700,700italic|consolas:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="js," />








  <link rel="shortcut icon" type="image/x-icon" href="http://ofy7k3v4s.bkt.clouddn.com/mylogo.png?v=5.0.2" />






<meta name="description" content="&amp;#x53D8;&amp;#x91CF;JavaScript&amp;#x662F;&amp;#x5F31;&amp;#x7C7B;&amp;#x578B;&amp;#x7684;&amp;#x8BED;&amp;#x8A00;&amp;#xFF0C;&amp;#x53D8;&amp;#x91CF;&amp;#x662F;&amp;#x677E;&amp;#x6563;&amp;#x7684;&amp;#x3002;&amp;#x6240;&amp;#x8C13;&amp;#x677E;&amp;#x6563;&amp;#x662F;&amp;#x53EF;&amp;#x4EE">
<meta property="og:type" content="article">
<meta property="og:title" content="js 变量和数据类型">
<meta property="og:url" content="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/index.html">
<meta property="og:site_name" content="HongqinMa' Blog">
<meta property="og:description" content="&amp;#x53D8;&amp;#x91CF;JavaScript&amp;#x662F;&amp;#x5F31;&amp;#x7C7B;&amp;#x578B;&amp;#x7684;&amp;#x8BED;&amp;#x8A00;&amp;#xFF0C;&amp;#x53D8;&amp;#x91CF;&amp;#x662F;&amp;#x677E;&amp;#x6563;&amp;#x7684;&amp;#x3002;&amp;#x6240;&amp;#x8C13;&amp;#x677E;&amp;#x6563;&amp;#x662F;&amp;#x53EF;&amp;#x4EE">
<meta property="og:image" content="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/6.1.png">
<meta property="og:image" content="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/6.2.png">
<meta property="og:updated_time" content="2016-11-07T14:59:12.573Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="js 变量和数据类型">
<meta name="twitter:description" content="&amp;#x53D8;&amp;#x91CF;JavaScript&amp;#x662F;&amp;#x5F31;&amp;#x7C7B;&amp;#x578B;&amp;#x7684;&amp;#x8BED;&amp;#x8A00;&amp;#xFF0C;&amp;#x53D8;&amp;#x91CF;&amp;#x662F;&amp;#x677E;&amp;#x6563;&amp;#x7684;&amp;#x3002;&amp;#x6240;&amp;#x8C13;&amp;#x677E;&amp;#x6563;&amp;#x662F;&amp;#x53EF;&amp;#x4EE">
<meta name="twitter:image" content="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/6.1.png">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '6347850919329138000',
      author: 'Hiraku'
    }
  };
</script>




  <link rel="canonical" href="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/"/>


  <title> js 变量和数据类型 | HongqinMa' Blog </title>
</head>

<body itemscope itemtype="//schema.org/WebPage" lang="en">

  



  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?10010323";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>








  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="//schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta custom-logo">
  
    <div class="site-meta-headline">
      <a>
        <img class="custom-logo-image" src="http://ofy7k3v4s.bkt.clouddn.com/photo.jpg"
             alt="HongqinMa' Blog"/>
      </a>
    </div>
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">HongqinMa' Blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">Spell at all costs， to rush you in the future。</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            Tags
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="//schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                js 变量和数据类型
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">Posted on</span>
            <time itemprop="dateCreated" datetime="2014-03-18T21:22:52+08:00" content="2014-03-18">
              2014-03-18
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">In</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/JavaScript/" itemprop="url" rel="index">
                    <span itemprop="name">JavaScript</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/2014/03/18/js-变量和数据类型/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2014/03/18/js-变量和数据类型/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          

          
          
             <span id="/2014/03/18/js-变量和数据类型/" class="leancloud_visitors" data-flag-title="js 变量和数据类型">
               &nbsp; | &nbsp;
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               <span class="post-meta-item-text">visitors </span>
               <span class="leancloud-visitors-count"></span>
              </span>
          

          
              &nbsp; | &nbsp;
              <span class="page-pv"><i class="fa fa-file-o"></i>
              <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
              </span>
          

          
          <span id="busuanzi_container_page_pv">  <span id="busuanzi_value_page_pv"></span> Views</span>
          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="&#x53D8;&#x91CF;"><a href="#&#x53D8;&#x91CF;" class="headerlink" title="&#x53D8;&#x91CF;"></a>&#x53D8;&#x91CF;</h2><p>JavaScript&#x662F;&#x5F31;&#x7C7B;&#x578B;&#x7684;&#x8BED;&#x8A00;&#xFF0C;&#x53D8;&#x91CF;&#x662F;&#x677E;&#x6563;&#x7684;&#x3002;&#x6240;&#x8C13;&#x677E;&#x6563;&#x662F;&#x53EF;&#x4EE5;&#x4FDD;&#x5B58;&#x4EFB;&#x4F55;&#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x3002;<br>&#x5373;&#x58F0;&#x660E;&#x4E0D;&#x540C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x4F7F;&#x7528;&#x540C;&#x4E00;&#x4E2A;&#x5173;&#x952E;&#x5B57; <code>var</code>&#xFF0C;<br>&#x53D8;&#x91CF;&#x5C31;&#x662F;&#x53D8;&#x5316;&#x7684;&#x91CF;&#xFF0C;&#x53D8;&#x91CF;&#x7684;&#x4F5C;&#x7528;&#x5C31;&#x662F;&#x7528;&#x6765;&#x88C5;&#x6570;&#x636E;&#x7684;&#x5BB9;&#x5668;&#x3002;<br>&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x7684;&#x65F6;&#x5019;&#x4E0D;&#x7528;&#x8003;&#x8651;&#x7C7B;&#x578B;&#xFF0C;&#x4F46;&#x662F;&#x5904;&#x7406;&#x548C;&#x8BA1;&#x7B97;&#x7684;&#x65F6;&#x5019;&#x8981;&#x8003;&#x8651;&#x7C7B;&#x578B;.</p>
<h3 id="&#x5B9A;&#x4E49;&#x53D8;&#x91CF;"><a href="#&#x5B9A;&#x4E49;&#x53D8;&#x91CF;" class="headerlink" title="&#x5B9A;&#x4E49;&#x53D8;&#x91CF;"></a>&#x5B9A;&#x4E49;&#x53D8;&#x91CF;</h3><p>&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x4F7F;&#x7528;&#x5173;&#x952E;&#x5B57; <code>var</code> &#x6765;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x540D;&#x3002;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="comment">// &#x5728;&#x5168;&#x5C40;&#x4F5C;&#x7528;&#x57DF;&#x4E0B;&#x58F0;&#x660E;&#x4E86;&#x53D8;&#x91CF; a</span></div><div class="line"><span class="keyword">var</span> a; </div><div class="line"><span class="comment">// &#x4F7F;&#x7528;&#x8D4B;&#x503C;&#x8FD0;&#x7B97;&#x7B26;&#x6765;&#x7ED9;&#x53D8;&#x91CF;&#x8D4B;&#x503C;</span></div><div class="line">a = <span class="string">&quot;a&#x6B64;&#x65F6;&#x662F;&#x5B57;&#x7B26;&#x4E32;&quot;</span>;</div></pre></td></tr></table></figure>
<hr>
<p>&#x8D4B;&#x503C;&#xFF1A;</p>
<ul>
<li>&#x8D4B;&#x503C;&#x8FD0;&#x7B97;&#x7B26;&#x4E3A;&#x201C;=&#x201D;&#xFF0C;&#x8FD9;&#x4E2A;&#x7B49;&#x53F7;&#x4E0D;&#x7528;&#x5224;&#x65AD;&#x4E24;&#x8005;&#x662F;&#x5426;&#x76F8;&#x540C;&#x3002;</li>
<li>&#x5982;&#x679C;&#x5224;&#x65AD;&#x662F;&#x5426;&#x76F8;&#x540C;&#xFF0C;&#x53EF;&#x4F7F;&#x7528;==&#xFF08;===&#xFF09;&#x3002;</li>
</ul>
<p>&#x4EE5;&#x4E0A;&#x4E24;&#x6B65;&#x53EF;&#x7B80;&#x5199;&#x4E3A;&#xFF1A;</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">var a = &quot;a&#x6B64;&#x65F6;&#x662F;&#x5B57;&#x7B26;&#x4E32;&quot;;</div></pre></td></tr></table></figure>
<p>&#x6CE8;&#x610F;&#xFF1A;</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">function foo(){</div><div class="line">  msg = &quot;&#x6211;&#x662F;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x5B9A;&#x4E49;&#x7684;&#x5168;&#x5C40;&#x53D8;&#x91CF;&quot;;</div><div class="line">}</div></pre></td></tr></table></figure>
<p>&#x4E0A;&#x9762;&#x4F8B;&#x5B50;&#x7701;&#x7565;&#x4E86; <code>var</code> &#x64CD;&#x4F5C;&#x7B26;&#xFF0C; msg &#x5C31;&#x53D8;&#x6210;&#x4E86;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#xFF0C;&#x51FD;&#x6570;&#x5916;&#x90E8;&#x4E5F;&#x80FD;&#x8BBF;&#x95EE;&#x5230;&#xFF0C;&#x4F46;&#x4E0D;&#x8981;&#x8FD9;&#x6837;&#x505A;&#xFF01;&#x3002;</p>
<h3 id="&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x8303;"><a href="#&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x8303;" class="headerlink" title="&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x8303;"></a>&#x53D8;&#x91CF;&#x547D;&#x540D;&#x89C4;&#x8303;</h3><ul>
<li>&#x7531;&#x5B57;&#x6BCD;&#x3001;&#x6570;&#x5B57;&#x3001;&#x4E0B;&#x5212;&#x7EBF;&#x3001;$ &#x7EC4;&#x6210;&#x4E14;&#x5F00;&#x5934;&#x4E0D;&#x80FD;&#x662F;&#x6570;&#x5B57;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x540D;&#x3002;</li>
<li>&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x7279;&#x6B8A;&#x7B26;&#x53F7;&#x6216;&#x8005;&#x7279;&#x6B8A;&#x7B26;&#x53F7;&#x5F00;&#x5934;&#x6765;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x540D;&#xFF08;_&#x9664;&#x5916;&#xFF09;&#x3002;</li>
<li>&#x4E0D;&#x80FD;&#x4EE5;&#x5173;&#x952E;&#x5B57;&#x6765;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x540D;</li>
<li>&#x53D8;&#x91CF;&#x7684;&#x540D;&#x79F0;&#x8981;&#x6709;&#x5B9E;&#x9645;&#x610F;&#x4E49;</li>
<li>&#x89C4;&#x5219;&#x4E2D;&#x6240;&#x8BF4;&#x7684;&#x5B57;&#x6BCD;&#x5305;&#x62EC;ASCII&#x548C;Unicode&#x5B57;&#x6BCD;&#x5B57;&#x7B26;&#xFF0C;&#x5982;&#x6C49;&#x5B57;&#xFF0C;&#x4F46;&#x4E0D;&#x63A8;&#x8350;&#x4F7F;&#x7528;</li>
<li>&#x53D8;&#x91CF;&#x7684;&#x547D;&#x540D;&#x9075;&#x5B88;&#x9A7C;&#x5CF0;&#x547D;&#x540D;&#x6CD5;&#xFF0C;&#x9996;&#x5B57;&#x6BCD;&#x5C0F;&#x5199;,&#x7B2C;&#x4E8C;&#x4E2A;&#x5355;&#x8BCD;&#x7684;&#x9996;&#x5B57;&#x6BCD;&#x5927;&#x5199; &#x4F8B;&#x5982;&#xFF1A;userName</li>
</ul>
<p><img src="/2014/03/18/js-&#x53D8;&#x91CF;&#x548C;&#x6570;&#x636E;&#x7C7B;&#x578B;/6.1.png" alt="&#x5173;&#x952E;&#x5B57;">; </p>
<ul>
<li>&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x4FDD;&#x7559;&#x5B57;&#x6765;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x540D;</li>
</ul>
<p><img src="/2014/03/18/js-&#x53D8;&#x91CF;&#x548C;&#x6570;&#x636E;&#x7C7B;&#x578B;/6.2.png" alt="&#x5173;&#x952E;&#x5B57;">; </p>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;&#x5728;JS&#x4E2D;&#xFF0C;&#x662F;&#x4E25;&#x683C;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;&#x7684;&#x3002;</strong> </p>
<h3 id="&#x6267;&#x884C;&#x73AF;&#x5883;&#x548C;&#x4F5C;&#x7528;&#x57DF;"><a href="#&#x6267;&#x884C;&#x73AF;&#x5883;&#x548C;&#x4F5C;&#x7528;&#x57DF;" class="headerlink" title="&#x6267;&#x884C;&#x73AF;&#x5883;&#x548C;&#x4F5C;&#x7528;&#x57DF;"></a>&#x6267;&#x884C;&#x73AF;&#x5883;&#x548C;&#x4F5C;&#x7528;&#x57DF;</h3><p>&#x6267;&#x884C;&#x73AF;&#x5883;&#x662F; JavaScript &#x4E2D;&#x6700;&#x4E3A;&#x91CD;&#x8981;&#x7684;&#x4E00;&#x4E2A;&#x6982;&#x5FF5;&#x3002;&#x5B9A;&#x4E49;&#x4E86;&#x53D8;&#x91CF;&#x6216;&#x51FD;&#x6570;&#x6709;&#x6743;&#x8BBF;&#x95EE;&#x5176;&#x5B83;&#x6570;&#x636E;&#x3002;<br>&#x6BCF;&#x4E2A;&#x73AF;&#x5883;&#x4E2D;&#x90FD;&#x6709;&#x4E00;&#x4E2A;&#x4E0E;&#x4E4B;&#x5173;&#x8054;&#x7684;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#xFF0C;&#x6211;&#x4EEC;&#x7F16;&#x5199;&#x7684;&#x4EE3;&#x7801;&#x65E0;&#x6CD5;&#x8BBF;&#x95EE;&#xFF0C;&#x4F46;&#x662F;&#x73AF;&#x5883;&#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#x53D8;&#x91CF;&#x5B58;&#x653E;&#x5728;&#x8FD9;&#x4E2A;&#x5BF9;&#x8C61;&#x4E2D;&#x3002;</p>
<p>&#x5168;&#x5C40;&#x6267;&#x884C;&#x73AF;&#x5883;&#x662F;&#x6700;&#x5916;&#x56F4;&#x7684;&#x4E00;&#x4E2A;&#x6267;&#x884C;&#x73AF;&#x5883;&#x3002;&#x6839;&#x636E; ECMAScript &#x5B9E;&#x73B0;&#x6240;&#x5728;&#x7684;&#x5BBF;&#x4E3B;&#x73AF;&#x5883;&#x7684;&#x4E0D;&#x540C;&#xFF0C;<br>&#x8868;&#x793A;&#x6267;&#x884C;&#x73AF;&#x5883;&#x7684;&#x5BF9;&#x8C61;&#x4E5F;&#x4E0D;&#x4E00;&#x6837;&#x3002;&#x5728; web &#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#xFF0C;&#x5168;&#x5C40;&#x6267;&#x884C;&#x73AF;&#x5883;&#x88AB;&#x8BA4;&#x4E3A;&#x662F; window &#x5BF9;&#x8C61;&#xFF0C;<br>&#x56E0;&#x6B64;&#x6240;&#x6709;&#x7684;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#x90FD;&#x662F;&#x4F5C;&#x4E3A; window &#x5BF9;&#x8C61;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x521B;&#x5EFA;&#x7684;&#x3002;&#x67D0;&#x4E2A;&#x73AF;&#x5883;&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#x5168;&#x90E8;&#x6267;&#x884C;&#x5B8C;&#xFF0C;<br>&#x8BE5;&#x73AF;&#x5883;&#x4E2D;&#x7684;&#x53D8;&#x91CF;&#x88AB;&#x9500;&#x6BC1;&#xFF0C;&#x4FDD;&#x5B58;&#x5728;&#x5176;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x7684;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#x5B9A;&#x4E49;&#x4E5F;&#x968F;&#x4E4B;&#x9500;&#x6BC1;&#x3002;<br>&#x5168;&#x5C40;&#x6267;&#x884C;&#x73AF;&#x5883;&#x76F4;&#x5230;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x9000;&#x51FA;&#x624D;&#x9500;&#x6BC1;&#x3002;</p>
<p>&#x6BCF;&#x4E2A;&#x51FD;&#x6570;&#x90FD;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x6267;&#x884C;&#x73AF;&#x5883;&#x3002;&#x5F53;&#x4EE3;&#x7801;&#x5728;&#x4E00;&#x4E2A;&#x73AF;&#x5883;&#x4E2D;&#x6267;&#x884C;&#x65F6;&#xFF0C;&#x4F1A;&#x521B;&#x5EFA;&#x4F5C;&#x7528;&#x57DF;&#x94FE;&#x3002;<br>&#x4F5C;&#x7528;&#x57DF;&#x94FE;&#x5F0F;&#x4FDD;&#x8BC1;&#x5BF9;&#x6267;&#x884C;&#x73AF;&#x5883;&#x6709;&#x6743;&#x8BBF;&#x95EE;&#x7684;&#x6240;&#x6709;&#x53D8;&#x91CF;&#x548C;&#x51FD;&#x6570;&#x7684;&#x6709;&#x5E8F;&#x8BBF;&#x95EE;&#x3002;<br>&#x4F5C;&#x7528;&#x57DF;&#x7684;&#x524D;&#x7AEF;&#x59CB;&#x7EC8;&#x90FD;&#x662F;&#x5F53;&#x524D;&#x6267;&#x884C;&#x7684;&#x4EE3;&#x7801;&#x6240;&#x5728;&#x73AF;&#x5883;&#x7684;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#x3002;<br>&#x5982;&#x679C;&#x8FD9;&#x4E2A;&#x73AF;&#x5883;&#x662F;&#x51FD;&#x6570;&#xFF0C;&#x5219;&#x5C06;&#x5176;&#x6D3B;&#x52A8;&#x5BF9;&#x8C61;&#x4F5C;&#x4E3A;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#x3002;<br>&#x6D3B;&#x52A8;&#x5BF9;&#x8C61;&#x5728;&#x6700;&#x5F00;&#x59CB;&#x7684;&#x65F6;&#x5019;&#x53EA;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#xFF0C;&#x5373; arguments &#x5BF9;&#x8C61;&#x3002;<br>&#x4F5C;&#x7528;&#x57DF;&#x4E2D;&#x7684;&#x4E0B;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#x6765;&#x8BF4;&#x5305;&#x542B;&#xFF08;&#x5916;&#x90E8;&#x7684;&#x73AF;&#x5883;&#xFF09;&#xFF0C;&#x800C;&#x518D;&#x4E0B;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#x5219;&#x6765;&#x81EA;&#x4E0B;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x73AF;&#x5883;&#x3002;<br>&#x8FD9;&#x6837;&#xFF0C;&#x4E00;&#x76F4;&#x5EF6;&#x7EED;&#x5230;&#x5168;&#x5C40;&#x6267;&#x884C;&#x73AF;&#x5883;&#xFF0C;&#x5168;&#x5C40;&#x6267;&#x884C;&#x73AF;&#x5883;&#x7684;&#x53D8;&#x91CF;&#x5BF9;&#x8C61;&#x59CB;&#x7EC8;&#x90FD;&#x662F;&#x4F5C;&#x7528;&#x57DF;&#x94FE;&#x4E2D;&#x7684;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x3002;</p>
<p>&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#x662F;&#x7A0B;&#x5E8F;&#x6E90;&#x4EE3;&#x7801;&#x4E2D;&#x5B9A;&#x4E49;&#x8FD9;&#x4E2A;&#x53D8;&#x91CF;&#x7684;&#x533A;&#x57DF;&#x3002;<br>&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x62E5;&#x6709;&#x5168;&#x5C40;&#x4F5C;&#x7528;&#x57DF;&#xFF0C;&#x5728; JavaScript &#x4EE3;&#x7801;&#x4E2D;&#x4EFB;&#x4F55;&#x5730;&#x65B9;&#x90FD;&#x662F;&#x6709;&#x5B9A;&#x4E49;&#x7684;&#x3002;<br>&#x800C;&#x5728;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x58F0;&#x660E;&#x7684;&#x53D8;&#x91CF;&#x53EA;&#x6709;&#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x6709;&#x5B9A;&#x4E49;&#xFF0C;&#x5B83;&#x4EEC;&#x662F;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x4F5C;&#x7528;&#x57DF;&#x662F;&#x5C40;&#x90E8;&#x7684;&#x3002;</p>
<p>&#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x90E8;&#xFF0C;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x9AD8;&#x4E8E;&#x540C;&#x540D;&#x7684;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x3002;</p>
<h4 id="&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x548C;&#x58F0;&#x660E;&#x63D0;&#x524D;"><a href="#&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x548C;&#x58F0;&#x660E;&#x63D0;&#x524D;" class="headerlink" title="&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x548C;&#x58F0;&#x660E;&#x63D0;&#x524D;"></a>&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x548C;&#x58F0;&#x660E;&#x63D0;&#x524D;</h4><p>&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;&#x662F;&#x6307;&#x5728;&#x4E00;&#x5BF9;&#x82B1;&#x62EC;&#x53F7;&#x5185;&#x7684;&#x4EE3;&#x7801;&#x90FD;&#x5177;&#x6709;&#x5404;&#x81EA;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#xFF0C;&#x800C;&#x4E14;&#x53D8;&#x91CF;&#x5728;&#x58F0;&#x660E;&#x5B83;&#x4EEC;&#x7684;&#x4EE3;&#x7801;&#x4E4B;&#x5916;&#x662F;&#x4E0D;&#x53EF;&#x89C1;&#x7684;&#x3002;<br>&#x4F46;&#x662F; JavaScript &#x6CA1;&#x6709;&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;&#x7684;&#x6982;&#x5FF5;&#x3002;&#x800C;&#x662F;&#x4F7F;&#x7528;&#x4E86;&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x3002;<br>JavaScript &#x7684;&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;&#x662F;&#x6307;&#x51FD;&#x6570;&#x5185;&#x58F0;&#x660E;&#x7684;&#x6240;&#x6709;&#x53D8;&#x91CF;&#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x59CB;&#x7EC8;&#x662F;&#x53EF;&#x89C1;&#x7684;&#x3002;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"><span class="function"><span class="keyword">function</span> <span class="title">test</span>(<span class="params">o</span>)</span>{</div><div class="line">  <span class="keyword">var</span> i = <span class="number">0</span>;                          <span class="comment">// i &#x5728;&#x6574;&#x4E2A;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x90E8;&#x6709;&#x5B9A;&#x4E49;</span></div><div class="line">  <span class="keyword">if</span> (<span class="keyword">typeof</span> o == <span class="string">&apos;object&apos;</span>){</div><div class="line">    <span class="keyword">var</span> j = <span class="number">0</span>;                        <span class="comment">// j &#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x6709;&#x5B9A;&#x4E49;</span></div><div class="line">    <span class="keyword">for</span>(<span class="keyword">var</span> k = <span class="number">0</span>; k &lt; <span class="number">10</span>; k++){      <span class="comment">// k &#x5728;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x662F;&#x6709;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x4E0D;&#x4EC5;&#x4EC5;&#x662F;&#x5728;&#x5FAA;&#x73AF;&#x5185;</span></div><div class="line">      <span class="built_in">console</span>.log(k);                 <span class="comment">// &#x8F93;&#x51FA; 0~9</span></div><div class="line">    }</div><div class="line">    <span class="built_in">console</span>.log(k);                   <span class="comment">// &#x8F93;&#x51FA; 10</span></div><div class="line">  }</div><div class="line">  <span class="built_in">console</span>.log(j);                     <span class="comment">// j &#x5DF2;&#x7ECF;&#x5B9A;&#x4E49;&#x4E86;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x80FD;&#x6CA1;&#x6709;&#x521D;&#x59CB;&#x5316;</span></div><div class="line">}</div></pre></td></tr></table></figure>
<h4 id="&#x4F5C;&#x4E3A;&#x5C5E;&#x6027;&#x7684;&#x53D8;&#x91CF;"><a href="#&#x4F5C;&#x4E3A;&#x5C5E;&#x6027;&#x7684;&#x53D8;&#x91CF;" class="headerlink" title="&#x4F5C;&#x4E3A;&#x5C5E;&#x6027;&#x7684;&#x53D8;&#x91CF;"></a>&#x4F5C;&#x4E3A;&#x5C5E;&#x6027;&#x7684;&#x53D8;&#x91CF;</h4><p>&#x5F53;&#x58F0;&#x660E;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x65F6;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#xFF0C;&#x5F53;&#x4F7F;&#x7528; var &#x58F0;&#x660E;&#x53D8;&#x91CF;&#x65F6;&#xFF0C;<br>&#x521B;&#x5EFA;&#x7684;&#x8FD9;&#x4E2A;&#x5BF9;&#x8C61;&#x662F;&#x4E0D;&#x53EF;&#x914D;&#x7F6E;&#x7684;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x8FD9;&#x4E2A;&#x53D8;&#x91CF;&#x4E0D;&#x80FD;&#x901A;&#x8FC7; delete &#x64CD;&#x4F5C;&#x7B26;&#x6765;&#x5220;&#x9664;&#x3002;<br>&#x5982;&#x679C;&#x5728;&#x975E;&#x4E25;&#x683C;&#x6A21;&#x5F0F;&#x4E0B;&#xFF0C;&#x7ED9;&#x4E00;&#x4E2A;&#x672A;&#x58F0;&#x660E;&#x7684;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x8D4B;&#x503C;&#x7684;&#x8BDD;&#xFF0C; JavaScript &#x4F1A;&#x81EA;&#x52A8;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x3002;<br>&#x4EE5;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x521B;&#x5EFA;&#x7684;&#x53D8;&#x91CF;&#x662F;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#x7684;&#x6B63;&#x5E38;&#x7684;&#x53EF;&#x914D;&#x7F6E;&#x5C5E;&#x6027;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x5220;&#x9664;&#x5B83;&#x4EEC;&#x3002;</p>
<h4 id="&#x4F5C;&#x7528;&#x57DF;&#x94FE;"><a href="#&#x4F5C;&#x7528;&#x57DF;&#x94FE;" class="headerlink" title="&#x4F5C;&#x7528;&#x57DF;&#x94FE;"></a>&#x4F5C;&#x7528;&#x57DF;&#x94FE;</h4><p>&#x5D4C;&#x5957;&#x7684;&#x51FD;&#x6570;&#x4F53;&#x5185;&#x90E8;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE;&#x5B83;&#x4E0A;&#x4E00;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;&#x4E2D;&#x7684;&#x53D8;&#x91CF;&#x3002;</p>
<p>&#x5EF6;&#x957F;&#x4F5C;&#x7528;&#x57DF;&#x94FE;&#xFF1A;</p>
<ul>
<li>try-catch &#x8BED;&#x53E5;</li>
<li>with &#x8BED;&#x53E5;</li>
</ul>
<h2 id="&#x5783;&#x573E;&#x6536;&#x96C6;"><a href="#&#x5783;&#x573E;&#x6536;&#x96C6;" class="headerlink" title="&#x5783;&#x573E;&#x6536;&#x96C6;"></a>&#x5783;&#x573E;&#x6536;&#x96C6;</h2><ul>
<li>&#x6807;&#x8BB0;&#x6E05;&#x9664;</li>
<li>&#x5F15;&#x7528;&#x8BA1;&#x6570;</li>
<li>&#x6027;&#x80FD;&#x95EE;&#x9898;</li>
<li>&#x7BA1;&#x7406;&#x5185;&#x5B58;</li>
</ul>
<hr>
<h2 id="&#x6570;&#x636E;&#x7C7B;&#x578B;"><a href="#&#x6570;&#x636E;&#x7C7B;&#x578B;" class="headerlink" title="&#x6570;&#x636E;&#x7C7B;&#x578B;"></a>&#x6570;&#x636E;&#x7C7B;&#x578B;</h2><p>javaScript &#x6570;&#x636E;&#x7C7B;&#x578B;&#x6709;&#x4E24;&#x7C7B;&#xFF1A; &#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B; &#x548C; &#x590D;&#x6742;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF0C;<br>&#x5176;&#x4E2D;&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF08;&#x7B80;&#x5355;&#x7C7B;&#x578B;&#xFF09;&#x6709;&#xFF1A; Number/String/Boolean/Uundefined/Null<br>&#x4E00;&#x79CD;&#x590D;&#x6742;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF1A;object&#xFF1A;Array/Date/Math/RegExp/</p>
<h3 id="typeof-&#x64CD;&#x4F5C;&#x7B26;"><a href="#typeof-&#x64CD;&#x4F5C;&#x7B26;" class="headerlink" title="typeof &#x64CD;&#x4F5C;&#x7B26;"></a>typeof &#x64CD;&#x4F5C;&#x7B26;</h3><ul>
<li>&#x201C;undefined&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x503C;&#x672A;&#x5B9A;&#x4E49;</li>
<li>&#x201C;boolean&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x503C;&#x662F;&#x5E03;&#x5C14;&#x503C;</li>
<li>&#x201C;string&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x53EA;&#x662F;&#x5B57;&#x7B26;&#x4E32;</li>
<li>&#x201C;number&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x503C;&#x662F;&#x6570;&#x503C;</li>
<li>&#x201C;object&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x503C;&#x662F;&#x5BF9;&#x8C61;&#x6216;null</li>
<li>&#x201C;function&#x201D; &#x2013;&gt; &#x8FD9;&#x4E2A;&#x503C;&#x662F;&#x51FD;&#x6570;</li>
</ul>
<p>typeof &#x64CD;&#x4F5C;&#x7B26;&#x53F7;&#x540E;&#x9762;&#x7684;&#x64CD;&#x4F5C;&#x6570;&#x53EF;&#x4EE5;&#x662F;&#x53D8;&#x91CF;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x9762;&#x91CF;&#xFF1B;</p>
<p>typeof &#x8BEF;&#x533A;&#xFF1A;</p>
<ul>
<li>null &#x503C;&#x8FD4;&#x56DE; &#x201C;object&#x201D;;</li>
<li>Safari5 &#x4EE5;&#x53CA;&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;&#x3001;Chrome7 &#x4EE5;&#x53CA;&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;&#x5BF9;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x8C03;&#x7528;&#x8FD4;&#x56DE;&#x201D;object&#x201D;&#xFF0C;</li>
<li>&#x5176;&#x4ED6;&#x6D4F;&#x89C8;&#x5668;&#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#x8FD4;&#x56DE;&#x201D;object&#x201D;</li>
<li>&#x672A;&#x521D;&#x59CB;&#x5316;&#x7684;&#x53D8;&#x91CF;&#x548C;&#x6CA1;&#x6709;&#x5B9A;&#x4E49;&#x7684;&#x53D8;&#x91CF;&#x64CD;&#x4F5C;&#x7B26; typeof &#x90FD;&#x8FD4;&#x56DE; &#x201C;undefined&#x201D;&#xFF0C; &#x4F46;&#x5B83;&#x4EEC;&#x6709;&#x672C;&#x8D28;&#x533A;&#x522B;</li>
</ul>
<h3 id="Nnumber-&#x6570;&#x5B57;&#x7C7B;&#x578B;"><a href="#Nnumber-&#x6570;&#x5B57;&#x7C7B;&#x578B;" class="headerlink" title="Nnumber &#x6570;&#x5B57;&#x7C7B;&#x578B;"></a>Nnumber &#x6570;&#x5B57;&#x7C7B;&#x578B;</h3><p>&#x5B57;&#x9762;&#x91CF;&#xFF1A; var num = &#x6570;&#x5B57;;</p>
<p>&#x5305;&#x62EC;&#x6B63;&#x6570;&#xFF0C;&#x8D1F;&#x6570;&#xFF0C;&#x5C0F;&#x6570;</p>
<ul>
<li>&#x53D6;&#x503C;&#x8303;&#x56F4;&#xFF1A;<ul>
<li>&#x80FD;&#x8868;&#x793A;&#x7684;&#x6700;&#x5927;&#x503C;&#x662F;&#xB1;1.7976931348623157&#x4E58;&#x4EE5;10&#x7684;308&#x6B21;&#x65B9;</li>
<li>&#x80FD;&#x8868;&#x793A;&#x7684;&#x6700;&#x5C0F;&#x503C;&#x662F;&#xB1;5 &#x4E58;&#x4EE5;10&#x7684;-324&#x6B21;&#x65B9;</li>
</ul>
</li>
<li>&#x8868;&#x793A;&#x65B9;&#x5F0F;<ul>
<li>&#x5341;&#x8FDB;&#x5236;</li>
<li>&#x5341;&#x516D;&#x8FDB;&#x5236; &#x4EE5; 0x &#x5F00;&#x5934;&#xFF0C;&#x4ECE; 0-9&#xFF0C;a(A) &#x5230; f&#xFF08;F&#xFF09;&#x7684;&#x8303;&#x56F4;&#x3002;</li>
<li>&#x516B;&#x8FDB;&#x5236; &#x4EE5; 0 &#x5F00;&#x5934;&#xFF0C;0-7 &#x7EC4;&#x6210;&#x3002;</li>
</ul>
</li>
<li>NaN  (not a number) &#x4E5F;&#x662F; number &#x7C7B;&#x578B;&#xFF0C;NaN &#x4E0D;&#x7B49;&#x4E8E;&#x81EA;&#x8EAB;</li>
<li><p>&#x4E24;&#x4E2A;&#x90FD;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x53D8;&#x91CF;&#x76F8;&#x51CF;&#xFF0C;&#x5F97;&#x5230;&#x7684;&#x662F;NaN.</p>
</li>
<li><p>&#x6D6E;&#x70B9;&#x6570;&#xFF1A;</p>
<ul>
<li>&#x8BA1;&#x7B97;&#x6D6E;&#x70B9;&#x6570;&#x65F6;&#x4F1A;&#x4E22;&#x5931;&#x7CBE;&#x5EA6;</li>
<li>&#x901A;&#x5E38;&#x7528;&#x6574;&#x6570;&#x7684;&#x8BA1;&#x7B97;&#x6765;&#x8868;&#x793A;&#x6D6E;&#x70B9;&#x6570;&#x7684;&#x8BA1;&#x7B97;</li>
<li>&#x4E0D;&#x8981;&#x4EE5;&#x4E24;&#x4E2A;&#x6D6E;&#x70B9;&#x6570;&#x662F;&#x5426;&#x76F8;&#x7B49;&#x4F5C;&#x4E3A;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x7684;&#x4F9D;&#x636E;&#xFF08;&#x5224;&#x65AD;&#x8303;&#x56F4;&#x8FD8;&#x662F;&#x53EF;&#x4EE5;&#x7684;&#xFF09;    </li>
</ul>
</li>
</ul>
<h2 id="String&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;"><a href="#String&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;" class="headerlink" title="String&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;"></a>String&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;</h2><p>&#x5B57;&#x9762;&#x91CF;&#xFF1A; var str = &#x201C;&#x5B57;&#x7B26;&#x4E32;&#x201D;;</p>
<p>&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x957F;&#x5EA6;&#xFF1A; str.length;</p>
<ul>
<li>&#x51E1;&#x662F;&#x7528;&#x201D;&#x201D;&#x6216;&#x8005;&#x2019;&#x2019;&#x5F15;&#x8D77;&#x6765;&#x7684;&#x5168;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#x3002;</li>
</ul>
<h3 id="&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#xFF1A;"><a href="#&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#xFF1A;" class="headerlink" title="&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#xFF1A;"></a>&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#xFF1A;</h3><ul>
<li>\&#x201D; &#x8F6C;&#x53CC;&#x5F15;&#x53F7;</li>
<li>\&#x2019; &#x8F6C;&#x5355;&#x5F15;</li>
<li>\r &#x56DE;&#x8F66;</li>
<li>\n &#x6362;&#x884C;</li>
<li>\t &#x5236;&#x8868;&#x7B26;</li>
<li>\f &#x8FDB;&#x7EB8;</li>
<li>\xnn &#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;(n &#x662F; 0~F)</li>
<li>\unnnn &#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x4EE3;&#x7801;nnnn&#x8868;&#x793A;&#x4E00;&#x4E2A; Unicode &#x5B57;&#x7B26; (n &#x662F; 0~F)</li>
</ul>
<h3 id="&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x7279;&#x70B9;"><a href="#&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x7279;&#x70B9;" class="headerlink" title="&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x7279;&#x70B9;"></a>&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x7279;&#x70B9;</h3><p>ECMAScript &#x4E2D;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x662F;&#x4E0D;&#x53EF;&#x53D8;&#x7684;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x4E00;&#x65E6;&#x521B;&#x5EFA;&#xFF0C;&#x5B83;&#x4EEC;&#x7684;&#x76F4;&#x5C31;&#x4E0D;&#x80FD;&#x6539;&#x53D8;&#x3002;<br>&#x8981;&#x6539;&#x53D8;&#x67D0;&#x4E2A;&#x53D8;&#x91CF;&#x4FDD;&#x5B58;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x9996;&#x5148;&#x8981;&#x9500;&#x6BC1;&#x539F;&#x6765;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x7136;&#x540E;&#x518D;&#x7528;&#x53E6;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x5FC3;&#x667A;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x586B;&#x5145;&#x8BE5;&#x53D8;&#x91CF;&#x3002;<br>&#x5982;&#xFF1A;</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">var str = &quot;Java&quot;;</div><div class="line">str = str + &quot;Script&quot;;</div></pre></td></tr></table></figure>
<h3 id="&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;"><a href="#&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;" class="headerlink" title="&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;"></a>&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;</h3><p>&#x6570;&#x503C;&#x3001;&#x5E03;&#x5C14;&#x503C;&#x3001;&#x5BF9;&#x8C61;&#x548C;&#x5B57;&#x7B26;&#x4E32;&#x503C;&#x90FD;&#x6709; <code>toString()</code> &#x65B9;&#x6CD5;, &#x4F46;&#x662F; null &#x548C; undefined &#x6CA1;&#x7528;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x8C03;&#x7528;toString() &#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x5927;&#x591A;&#x6570;&#x60C5;&#x51B5;&#x4E0B;&#x4E0D;&#x4F20;&#x53C2;&#x6570;&#xFF0C;&#x4F46;&#x662F;&#x5982;&#x679C;&#x4F20;&#x9012;&#x4E86;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x8F93;&#x51FA;&#x6570;&#x503C;&#x7684;&#x57FA;&#x6570;&#x3002;<br>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;toString() &#x65B9;&#x6CD5;&#x4EE5;&#x5341;&#x8FDB;&#x5236;&#x683C;&#x5F0F;&#x8FD4;&#x56DE;&#x6570;&#x503C;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;&#x3002;<br>&#x800C;&#x901A;&#x8FC7;&#x4F20;&#x9012;&#x57FA;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x8F93;&#x51FA;&#x5BF9;&#x5E94;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x3001;&#x516B;&#x8FDB;&#x5236;&#x3001;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x3002;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">var</span> n = <span class="number">10</span>;</div><div class="line"><span class="built_in">console</span>.log(n.toString());   <span class="comment">// &quot;10&quot;</span></div><div class="line"><span class="built_in">console</span>.log(n.toString(<span class="number">2</span>));   <span class="comment">// &quot;1010&quot;</span></div><div class="line"><span class="built_in">console</span>.log(n.toString(<span class="number">8</span>));   <span class="comment">// &quot;12&quot;</span></div><div class="line"><span class="built_in">console</span>.log(n.toString(<span class="number">10</span>));   <span class="comment">// &quot;10&quot;</span></div><div class="line"><span class="built_in">console</span>.log(n.toString(<span class="number">16</span>));   <span class="comment">// &quot;a&quot;</span></div></pre></td></tr></table></figure>
<p>&#x5728;&#x4E0D;&#x77E5;&#x9053;&#x8981;&#x8F6C;&#x6362;&#x7684;&#x503C;&#x662F;&#x4EC0;&#x4E48;&#x7C7B;&#x578B;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53EF;&#x4EE5;&#x7528; String() &#x51FD;&#x6570;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x5C06;&#x4EFB;&#x610F;&#x7C7B;&#x578B;&#x8F6C;&#x6210;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<h2 id="Boolean-&#x5E03;&#x5C14;&#x7C7B;&#x578B;"><a href="#Boolean-&#x5E03;&#x5C14;&#x7C7B;&#x578B;" class="headerlink" title="Boolean &#x5E03;&#x5C14;&#x7C7B;&#x578B;"></a>Boolean &#x5E03;&#x5C14;&#x7C7B;&#x578B;</h2><ul>
<li>&#x5E03;&#x5C14;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x4E24;&#x4E2A;&#x6570;&#x636E;&#x503C;: true/false</li>
<li>&#x5B9E;&#x9645;&#x8FD0;&#x7B97;&#x4E2D;&#xFF0C;true &#x4EE3;&#x8868;1, false&#x4EE3;&#x8868;0;</li>
</ul>
<h2 id="Undefined-&#x8868;&#x793A;&#x58F0;&#x660E;&#x4F46;&#x672A;&#x8D4B;&#x503C;&#x7684;&#x53D8;&#x91CF;"><a href="#Undefined-&#x8868;&#x793A;&#x58F0;&#x660E;&#x4F46;&#x672A;&#x8D4B;&#x503C;&#x7684;&#x53D8;&#x91CF;" class="headerlink" title="Undefined &#x8868;&#x793A;&#x58F0;&#x660E;&#x4F46;&#x672A;&#x8D4B;&#x503C;&#x7684;&#x53D8;&#x91CF;"></a>Undefined &#x8868;&#x793A;&#x58F0;&#x660E;&#x4F46;&#x672A;&#x8D4B;&#x503C;&#x7684;&#x53D8;&#x91CF;</h2><p>&#x5728; js &#x4E2D;&#xFF0C;&#x4E00;&#x4E0B;&#x56DB;&#x79CD;&#x60C5;&#x51B5;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x662F; undefined</p>
<ul>
<li>&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x4E86;&#x4F46;&#x6CA1;&#x6709;&#x8D4B;&#x503C;</li>
<li>&#x51FD;&#x6570;&#x6CA1;&#x6709;&#x8FD4;&#x56DE;&#x503C;&#x9ED8;&#x8BA4;&#x8FD4;&#x56DE;undefined</li>
<li>&#x51FD;&#x6570;&#x4F20;&#x9012;&#x7684;&#x5B9E;&#x53C2;&#x4E2A;&#x6570;&#x5C11;&#x4E8E;&#x5F62;&#x53C2;&#x4E2A;&#x6570;&#x65F6;&#xFF0C;&#x672A;&#x4F20;&#x9012;&#x7684;&#x53C2;&#x6570;&#x503C;&#x4E3A;undefined</li>
<li>&#x5BF9;&#x8C61;&#x6CA1;&#x6709;&#x5B9A;&#x4E49;&#x7684;&#x5C5E;&#x6027;&#x9ED8;&#x8BA4;&#x4E3A;undefined</li>
</ul>
<h2 id="Null"><a href="#Null" class="headerlink" title="Null"></a>Null</h2><p>&#x7528; <code>typeof</code> &#x5224;&#x65AD;&#x65F6;&#x503C;&#x4E3A; <code>object</code> (&#x503C;&#x4E3A;&#x7A7A;)/&#x5F15;&#x7528;&#x4E3A;&#x7A7A;&#xFF0C;&#x5185;&#x5B58;&#x91CC;&#x627E;&#x4E0D;&#x5230;&#x8FD9;&#x4E2A;&#x53D8;&#x91CF;&#x3002;</p>
<p>&#x518D;&#x5982;&#xFF1A;</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">console</span>.log(<span class="literal">undefined</span> == <span class="literal">null</span>);  <span class="comment">// true &#x4E24;&#x7B49;&#x53F7;&#x5224;&#x65AD;&#xFF0C;&#x4E24;&#x8FB9;&#x90FD;&#x8F6C;&#x6210;false</span></div></pre></td></tr></table></figure>
<p>&#x603B;&#x7684;&#x6765;&#x8BF4;&#xFF0C;&#x53EA;&#x8981;&#x610F;&#x5728;&#x4FDD;&#x5B58;&#x5BF9;&#x8C61;&#x7684;&#x53D8;&#x91CF;&#x8FD8;&#x6CA1;&#x6709;&#x771F;&#x6B63;&#x4FDD;&#x5B58;&#x5BF9;&#x8C61;&#xFF0C;&#x5C31;&#x5E94;&#x8BE5;&#x8BA9;&#x8BE5;&#x53D8;&#x91CF;&#x4FDD;&#x5B58; null &#x503C;&#xFF0C;<br>&#x8FD9;&#x6837;&#x505A;&#x4F53;&#x73B0;&#x4E86; null &#x4F5C;&#x4E3A;&#x7A7A;&#x5BF9;&#x8C61;&#x6307;&#x9488;&#x7684;&#x60EF;&#x4F8B;&#xFF0C;&#x4E5F;&#x533A;&#x5206;&#x4E86; undefined &#x548C; null&#x3002;</p>
<hr>
<h2 id="&#x590D;&#x6742;&#x7C7B;&#x578B;&#xFF08;&#x6765;&#x81EA;-JavaScript-&#x9AD8;&#x7EA7;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF09;"><a href="#&#x590D;&#x6742;&#x7C7B;&#x578B;&#xFF08;&#x6765;&#x81EA;-JavaScript-&#x9AD8;&#x7EA7;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF09;" class="headerlink" title="&#x590D;&#x6742;&#x7C7B;&#x578B;&#xFF08;&#x6765;&#x81EA; JavaScript &#x9AD8;&#x7EA7;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF09;"></a>&#x590D;&#x6742;&#x7C7B;&#x578B;&#xFF08;&#x6765;&#x81EA; JavaScript &#x9AD8;&#x7EA7;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#xFF09;</h2><ul>
<li>object &#x5BF9;&#x8C61;</li>
</ul>
<p>ECMAScript &#x4E2D;&#x7684;&#x5BF9;&#x8C61;&#x5C31;&#x662F;&#x4E00;&#x7EC4;&#x6570;&#x636E;&#x548C;&#x529F;&#x80FD;&#x7684;&#x96C6;&#x5408;&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; new &#x64CD;&#x4F5C;&#x7B26;&#x540E;&#x8DDF;&#x8981;&#x521B;&#x5EFA;&#x7684;&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#x7684;&#x540D;&#x79F0;&#x6765;&#x521B;&#x5EFA;&#x3002;<br>&#x800C;&#x521B;&#x5EFA; Object &#x7C7B;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x5E76;&#x4E3A;&#x5176;&#x6DFB;&#x52A0;&#x5C5E;&#x6027;&#x6216;&#x65B9;&#x6CD5;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x81EA;&#x5B9A;&#x4E49;&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&#xFF1A;</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">var o = new Object();</div></pre></td></tr></table></figure>
<h3 id="Object-&#x7684;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x5177;&#x6709;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;"><a href="#Object-&#x7684;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x5177;&#x6709;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;" class="headerlink" title="Object &#x7684;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x5177;&#x6709;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;"></a>Object &#x7684;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x5177;&#x6709;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;</h3><ul>
<li>constructor&#xFF1A; &#x4FDD;&#x5B58;&#x7740;&#x7528;&#x4E8E;&#x521B;&#x5EFA;&#x5F53;&#x524D;&#x5BF9;&#x8C61;&#x7684;&#x51FD;&#x6570;&#xFF0C;&#x5373;&#x6784;&#x9020;&#x51FD;&#x6570;&#x3002;</li>
<li>hasOwnProperty(propertyName): &#x7528;&#x4E8E;&#x68C0;&#x67E5;&#x7ED9;&#x5B9A;&#x7684;&#x5C5E;&#x6027;&#x5728;&#x5F53;&#x524D;&#x5BF9;&#x8C61;&#x7684;&#x5B9E;&#x4F8B;&#x4E2D;(&#x800C;&#x4E0D;&#x662F;&#x5728;&#x539F;&#x578B;&#x4E2D;)&#x5B58;&#x5728;&#xFF1B;&#x53C2;&#x6570;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;</li>
<li>isPrototypeOf(object): &#x68C0;&#x67E5;&#x4F20;&#x5165;&#x7684;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x662F;&#x4F20;&#x5165;&#x5BF9;&#x8C61;&#x7684;&#x539F;&#x578B;&#x3002;</li>
<li>propertyIsEnumerable(propertyName): &#x68C0;&#x67E5;&#x7ED9;&#x5B9A;&#x7684;&#x5C5E;&#x6027;&#x662F;&#x5426;&#x80FD;&#x591F;&#x4F7F;&#x7528; for-in &#x8BED;&#x8A00;&#x6765;&#x679A;&#x4E3E;&#x3002;&#x53C2;&#x6570;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3002;</li>
<li>toLocalString(): &#x8FD4;&#x56DE;&#x5BF9;&#x8C61;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;&#xFF0C;&#x8BE5;&#x5B57;&#x7B26;&#x4E32;&#x4E0E;&#x6267;&#x884C;&#x73AF;&#x5883;&#x7684;&#x5730;&#x533A;&#x5BF9;&#x5E94;&#x3002;</li>
<li>toString(): &#x8FD4;&#x56DE;&#x5BF9;&#x8C61;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;&#x3002;</li>
<li>valueOf(): &#x8FD4;&#x56DE;&#x5BF9;&#x8C61;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x6570;&#x503C;&#x3001;&#x6216;&#x5E03;&#x5C14;&#x503C;&#x8868;&#x793A;&#x3002;&#x901A;&#x5E38;&#x4E0E; toString() &#x65B9;&#x6CD5;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x76F8;&#x540C;&#x3002;</li>
</ul>
<hr>
<h2 id="&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;"><a href="#&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;" class="headerlink" title="&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;"></a>&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;</h2><p>&#x9690;&#x5F0F;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;</p>
<p>&#x53D8;&#x91CF;&#x53C2;&#x4E0E;&#x5230;&#x8FD0;&#x7B97;&#x4E2D;&#xFF0C;&#x7A0B;&#x5E8F;&#x5BF9;&#x53D8;&#x91CF;&#x8FDB;&#x884C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&#xFF08;&#x4E0D;&#x662F;&#x7A0B;&#x5E8F;&#x5458;&#x8FDB;&#x884C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF09;</p>
<p>&#x5F3A;&#x5236;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8F6C;&#x6362;</p>
<ul>
<li>&#x5C06;&#x6570;&#x5B57;&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;<ul>
<li>String   </li>
<li>&#x53D8;&#x91CF;.toString &#xFF0C;&#x6CE8;&#x610F;&#xFF1A;null &#x548C; undefined &#x6CA1;&#x6709; toString() &#x65B9;&#x6CD5;</li>
</ul>
</li>
<li>&#x5C06;&#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x5B57;<ul>
<li>Number<ul>
<li>&#x8F6C;&#x6362;&#x540E;&#x4FDD;&#x7559;&#x539F;&#x6570;&#x636E;&#xFF0C;&#x4E0D;&#x4F1A;&#x5BF9;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x56DB;&#x820D;&#x4E94;&#x5165;&#x3002;</li>
<li>&#x975E;&#x6570;&#x5B57;&#x7C7B;&#x578B;&#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x6362;&#x540E;&#xFF0C;&#x6BD4;&#x5982; undefined&#xFF0C;&#x5F97;&#x5230; NaN &#x3002;</li>
<li>&#x5982;&#x679C;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x5305;&#x542B;&#x6709;&#x6548;&#x7684;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x683C;&#x5F0F;&#xFF0C;&#x5219;&#x5C06;&#x5176;&#x8F6C;&#x6362;&#x4E3A;&#x76F8;&#x540C;&#x5927;&#x5C0F;&#x7684;&#x5341;&#x8FDB;&#x5236;&#x6574;&#x6570;&#x503C;&#x3002;</li>
</ul>
</li>
<li>parseInt<ul>
<li>&#x5BF9;&#x5C0F;&#x6570;&#x8F6C;&#x6362;&#x540E;&#x4FDD;&#x7559;&#x7684;&#x662F;&#x6574;&#x6570;&#x90E8;&#x5206;&#xFF0C;&#x4E0D;&#x4F1A;&#x5BF9;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x56DB;&#x820D;&#x4E94;&#x5165;&#x3002;</li>
<li>&#x5982;&#x679C;&#x662F;&#x6570;&#x5B57;&#x540E;&#x8FB9;&#x6709;&#x975E;&#x6570;&#x5B57;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x8F6C;&#x6362;&#x540E;&#x5F97;&#x5230;&#x7684;&#x662F;&#x524D;&#x8FB9;&#x6570;&#x5B57;&#x7684;&#x6574;&#x6570;&#x90E8;&#x5206;&#x3002;</li>
</ul>
</li>
<li>parseFloat<ul>
<li>&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x5B57;&#x7C7B;&#x578B;&#x4E4B;&#x540E;&#x4FDD;&#x7559;&#x539F;&#x6570;&#x636E;&#xFF0C;&#x4E0D;&#x8FDB;&#x884C;&#x56DB;&#x820D;&#x4E94;&#x5165;&#x3002;</li>
<li>&#x975E;&#x6570;&#x5B57;&#x7C7B;&#x578B;&#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x6362;&#x540E;&#xFF0C;&#x5F97;&#x5230; NaN &#x3002;</li>
<li>&#x5982;&#x679C;&#x662F;&#x6570;&#x5B57;&#x540E;&#x8FB9;&#x6709;&#x975E;&#x6570;&#x5B57;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x8F6C;&#x6362;&#x540E;&#x5F97;&#x5230;&#x7684;&#x662F;&#x524D;&#x8FB9;&#x6570;&#x5B57;&#x7684;&#x90E8;&#x5206;&#x3002;</li>
</ul>
</li>
</ul>
</li>
<li>&#x5C06;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x8F6C;&#x6362;&#x4E3A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;&#xFF1A;&#x6240;&#x6709;&#x7C7B;&#x578B;&#x7684;&#x503C;&#x90FD;&#x53EF;&#x4EE5;&#x8F6C;&#x5316;&#x6210;&#x5E03;&#x5C14;&#x503C;<ul>
<li>Boolean</li>
<li>&#x4F1A;&#x8F6C;&#x5316;&#x6210;false&#x7684;&#x503C;&#x6709;&#xFF1A; <ul>
<li>&#x7A7A;&#x5B57;&#x7B26;&#x4E32; </li>
<li>&#x6570;&#x503C;&#x96F6;</li>
<li>NaN </li>
<li>undefined </li>
<li>null</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>&#x5047;&#x503C;&#xFF1A;&#x7A7A;&#x5B57;&#x7B26;&#x4E32;&#x201D;&#x201D;/&#x6570;&#x5B57;0/null/undefined/false/NaN</strong></p>
<hr>
<h2 id="&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x603B;&#x7ED3;"><a href="#&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x603B;&#x7ED3;" class="headerlink" title="&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x603B;&#x7ED3;"></a>&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x548C;&#x590D;&#x6742;&#x7C7B;&#x578B;&#x603B;&#x7ED3;</h2><ul>
<li>&#x57FA;&#x672C;&#x7C7B;&#x578B;&#x2014;&#x503C;&#x7C7B;&#x578B;&#x2014; String Undefined Number Boolean Null</li>
<li><p>&#x590D;&#x6742;&#x7C7B;&#x578B;&#x2014;&#x5F15;&#x7528;&#x7C7B;&#x578B;&#x2013; Object &#x6570;&#x7EC4;&#x2013;Array,Date&#x2026;.</p>
</li>
<li><p>&#x57FA;&#x672C;&#x7C7B;&#x578B;&#x7684;&#x503C;&#x5B58;&#x50A8;&#x5728;&#x2014;- &#x6808;&#x4E2D;</p>
</li>
<li><p>&#x590D;&#x6742;&#x7C7B;&#x578B;&#x7684;&#x5730;&#x5740;(&#x5F15;&#x7528;)&#x5B58;&#x50A8;&#x5728;&#x6808;&#x4E2D;,&#x2014;&#x5730;&#x5740;&#x6307;&#x5411;&#x7684;&#x7A7A;&#x95F4;&#x4E2D;&#x7684;&#x5BF9;&#x8C61;(&#x5BF9;&#x8C61;)&#x2014;&#x5BF9;&#x8C61;&#x5B58;&#x50A8;&#x5728;&#x5806;&#x4E2D;</p>
<ul>
<li>&#x521B;&#x5EFA;&#x5BF9;&#x8C61;&#x5E76;&#x8FD4;&#x56DE;&#x5BF9;&#x8C61;&#x2014;&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x5BF9;&#x8C61;&#x7684;&#x5730;&#x5740;(&#x5BF9;&#x8C61;&#x5728;&#x5806;&#x7A7A;&#x95F4;&#x4E2D;&#x7684;&#x5730;&#x5740;)</li>
</ul>
</li>
<li><p>&#x57FA;&#x672C;&#x7C7B;&#x578B;&#x4F20;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F20;&#x9012;&#x7684;&#x662F;&#x503C;</p>
</li>
<li>&#x590D;&#x6742;&#x7C7B;&#x578B;(&#x5F15;&#x7528;&#x7C7B;&#x578B;)&#x4F20;&#x9012;&#x7684;&#x65F6;&#x5019;,&#x4F20;&#x9012;&#x7684;&#x662F;:&#x5730;&#x5740;(&#x5F15;&#x7528;)</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将是我最大的鼓励！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="http://ofy7k3v4s.bkt.clouddn.com/wcpayCode.jpg" alt="Hongqin Ma WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="http://ofy7k3v4s.bkt.clouddn.com/apayCode.jpg" alt="Hongqin Ma Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/js/" rel="tag">#js</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2014/03/12/js-词法结构/" rel="next" title="js 词法结构">
                <i class="fa fa-chevron-left"></i> js 词法结构
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2014/03/28/js-表达式和运算符/" rel="prev" title="js 表达式和运算符">
                js 表达式和运算符 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2014/03/18/js-变量和数据类型/"
     data-title="js 变量和数据类型"
     data-content=""
     data-url="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2014/03/18/js-变量和数据类型/"
           data-title="js 变量和数据类型" data-url="https://hongqinma.github.io/2014/03/18/js-变量和数据类型/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            Overview
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="//schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/photo.jpg"
               alt="Hongqin Ma" />
          <p class="site-author-name" itemprop="name">Hongqin Ma</p>
          <p class="site-description motion-element" itemprop="description">Spell at all costs， to rush you in the future. </p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">20</span>
              <span class="site-state-item-name">posts</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">3</span>
                <span class="site-state-item-name">categories</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">tags</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/HongqinMa" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/HongqinMa" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.facebook.com/profile.php?id=100006581058735" target="_blank" title="Facebook">
                  
                    <i class="fa fa-fw fa-facebook"></i>
                  
                  Facebook
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://www.zhihu.com/people/HirakuMa" target="_blank" title="知乎">
                  
                    <i class="fa fa-fw fa-share-alt"></i>
                  
                  知乎
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/rubylouvre/" title="司徒正美" target="_blank">司徒正美</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/sanshi/" title="三生石上" target="_blank">三生石上</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.cnblogs.com/TomXu/" title="汤姆大叔" target="_blank">汤姆大叔</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://gold.xitu.io/" title="掘金" target="_blank">掘金</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://segmentfault.com/" title="segmentfault" target="_blank">segmentfault</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.jianshu.com/users/1cbb94e5ed4d/latest_articles" title="简书" target="_blank">简书</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://home.cnblogs.com/" title="博客园" target="_blank">博客园</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://www.awesomes.cn/" title="Awesomes" target="_blank">Awesomes</a>
                </li>
              
            </ul>
          </div>
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#变量"><span class="nav-number">1.</span> <span class="nav-text">变量</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#定义变量"><span class="nav-number">1.1.</span> <span class="nav-text">定义变量</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#变量命名规范"><span class="nav-number">1.2.</span> <span class="nav-text">变量命名规范</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#执行环境和作用域"><span class="nav-number">1.3.</span> <span class="nav-text">执行环境和作用域</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#函数作用域和声明提前"><span class="nav-number">1.3.1.</span> <span class="nav-text">函数作用域和声明提前</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#作为属性的变量"><span class="nav-number">1.3.2.</span> <span class="nav-text">作为属性的变量</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#作用域链"><span class="nav-number">1.3.3.</span> <span class="nav-text">作用域链</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#垃圾收集"><span class="nav-number">2.</span> <span class="nav-text">垃圾收集</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#数据类型"><span class="nav-number">3.</span> <span class="nav-text">数据类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#typeof-操作符"><span class="nav-number">3.1.</span> <span class="nav-text">typeof 操作符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Nnumber-数字类型"><span class="nav-number">3.2.</span> <span class="nav-text">Nnumber 数字类型</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#String，字符串类型"><span class="nav-number">4.</span> <span class="nav-text">String，字符串类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#转义字符："><span class="nav-number">4.1.</span> <span class="nav-text">转义字符：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串的特点"><span class="nav-number">4.2.</span> <span class="nav-text">字符串的特点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#转换为字符串"><span class="nav-number">4.3.</span> <span class="nav-text">转换为字符串</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Boolean-布尔类型"><span class="nav-number">5.</span> <span class="nav-text">Boolean 布尔类型</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Undefined-表示声明但未赋值的变量"><span class="nav-number">6.</span> <span class="nav-text">Undefined 表示声明但未赋值的变量</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Null"><span class="nav-number">7.</span> <span class="nav-text">Null</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#复杂类型（来自-JavaScript-高级程序设计）"><span class="nav-number">8.</span> <span class="nav-text">复杂类型（来自 JavaScript 高级程序设计）</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Object-的每个实例具有的属性和方法"><span class="nav-number">8.1.</span> <span class="nav-text">Object 的每个实例具有的属性和方法</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#数据类型转换"><span class="nav-number">9.</span> <span class="nav-text">数据类型转换</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#基本数据类型和复杂类型总结"><span class="nav-number">10.</span> <span class="nav-text">基本数据类型和复杂类型总结</span></a></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Hongqin Ma</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>

<div class="theme-info">
  Theme -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span id="busuanzi_container_site_pv">
    &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;Page Views: <span id="busuanzi_value_site_pv"></span> 
</span>

        

<div class="busuanzi-count">

  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv"><i class="fa fa-user"></i><span class="busuanzi-value" id="busuanzi_value_site_uv"></span></span>
  

  
    <span class="site-pv"><i class="fa fa-eye"></i><span class="busuanzi-value" id="busuanzi_value_site_pv"></span></span>
  
  
</div>



        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"Hiraku"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  

  

  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("PPmoIQxeu8Sd21h6Tl9TthNx-gzGzoHsz", "rTvbY2H7DvWzRipiBwn72RQ4");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  
  <!-- custom analytics part create by xiamo -->
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
<script>AV.initialize("PPmoIQxeu8Sd21h6Tl9TthNx-gzGzoHsz", "rTvbY2H7DvWzRipiBwn72RQ4");</script>
<script>
function showTime(Counter) {
  var query = new AV.Query(Counter);
  $(".leancloud_visitors").each(function() {
    var url = $(this).attr("id").trim();
    query.equalTo("url", url);
    query.find({
      success: function(results) {
        if (results.length == 0) {
          var content = '0 ' + $(document.getElementById(url)).text();
          $(document.getElementById(url)).text(content);
          return;
        }
        for (var i = 0; i < results.length; i++) {
          var object = results[i];
          var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
          $(document.getElementById(url)).text(content);
        }
      },
      error: function(object, error) {
        console.log("Error: " + error.code + " " + error.message);
      }
    });

  });
}

function addCount(Counter) {
  var Counter = AV.Object.extend("Counter");
  url = $(".leancloud_visitors").attr('id').trim();
  title = $(".leancloud_visitors").attr('data-flag-title').trim();
  var query = new AV.Query(Counter);
  query.equalTo("url", url);
  query.find({
    success: function(results) {
      if (results.length > 0) {
        var counter = results[0];
        counter.fetchWhenSave(true);
        counter.increment("time");
        counter.save(null, {
          success: function(counter) {
            var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
            $(document.getElementById(url)).text(content);
          },
          error: function(counter, error) {
            console.log('Failed to save Visitor num, with error message: ' + error.message);
          }
        });
      } else {
        var newcounter = new Counter();
        newcounter.set("title", title);
        newcounter.set("url", url);
        newcounter.set("time", 1);
        newcounter.save(null, {
          success: function(newcounter) {
              console.log("newcounter.get('time')="+newcounter.get('time'));
            var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
            $(document.getElementById(url)).text(content);
          },
          error: function(newcounter, error) {
            console.log('Failed to create');
          }
        });
      }
    },
    error: function(error) {
      console.log('Error:' + error.code + " " + error.message);
    }
  });
}
$(function() {
  var Counter = AV.Object.extend("Counter");
  if ($('.leancloud_visitors').length == 1) {
    addCount(Counter);
  } else if ($('.post-title-link').length > 1) {
    showTime(Counter);
  }
}); 
</script>

  
</body>
</html>
